package a.oschina.observedemo.demo5;

/**
 * &lt;功能详细描述&gt;
 *
 * @author Administrator
 * @version [版本号, 2018/10/23]
 * @see [相关类/方法]
 * @since [产品/模块版本]
 */
public class Test5 {
    public static void main(String[] args) {
        Notifier boss = new Boss();

        NbaMatcher nbaMatcher = new NbaMatcher("NBA球赛", boss);
        ComicMatcher comicMatcher = new ComicMatcher("喜剧", boss);


        boss.setAction("班主任回来了");

        try {
            boss.update=nbaMatcher.getClass().getMethod("closeNbaMatch",new Class[]{String.class});
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }

        boss.notifyObserver(nbaMatcher);

        try {
            boss.update=comicMatcher.getClass().getMethod("closeComicMatch",new Class[]{String.class});
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }

        boss.notifyObserver(comicMatcher);
    }
}
